﻿module poseidon.controller.debugcontrol.breakpoint;

class CBreakPoint
{
private:
	int id;


public:
	char[]	fullPath;
	int		lineNum;
	
	this( char[] _fullpath, int _lineNum )
	{
		fullPath = _fullpath;
		lineNum = _lineNum;
	}
}


class CVariableNode
{
private:
	CVariableNode 	father;
	CVariableNode[] children;

	
public:
	char[] 	_scope, _name, _type, _value, _hex, _ext;

	this( char[] s, char[] n = null, char[] t = null, char[] v = null, char[] h = null, char[] e = null )
	{
		_scope 	= s;
		_name	= n;
		_type	= t;
		_value 	= v;
		_hex	= h;
		_ext	= e;
	}
	
	~this()
	{
		if( children.length > 0 )
		{
			for( int i = 0; i < children.length; ++ i )
				if( children[i] !is null ) delete children[i];
		}
	
		children.length = 0;		
	}

	CVariableNode add(  char[] s, char[] n = null, char[] t = null, char[] v = null, char[] h = null, char[] e = null )
	{
		CVariableNode son = new CVariableNode( s, n, t, v, h, e );
		son.father = this;
		children ~= son;

		return son;
	}

	CVariableNode getRoot(){ return father; }

	CVariableNode getLeaf( int i )
	{
		if( children.length >= i ) return children[i];
		return null;
	}

	CVariableNode[] getAllLeaf(){ return children; }

	uint getLeafCount(){ return children.length; }
}